package cn.funnymap.lgis.tools.crs;

import org.geotools.referencing.crs.DefaultGeographicCRS;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.crs.CoordinateReferenceSystem;

/**
 * 地理坐标参考系统
 *
 * @author jiaoxn
 */
public class GeographicCRS {
    private GeographicCRS() {}

    public static final CoordinateReferenceSystem WGS84;
    public static final CoordinateReferenceSystem CGCS2000;

    static {
        WGS84 = DefaultGeographicCRS.WGS84;
        try {
            CGCS2000 = org.geotools.referencing.CRS.decode("EPSG:4490", true);
        } catch (FactoryException e) {
            throw new RuntimeException(e);
        }
    }

    public static CoordinateReferenceSystem getByEpsgCode(int code) {
        switch (code) {
            case 4490:
                return CGCS2000;
            case 4326:
            default:
                return WGS84;
        }
    }
}
